package lrz.shiftplanner.calendar;

import java.util.LinkedList;
import java.util.List;

public enum DayType {
	Regular, Weekend, Holiday;
	
	/* Safes the number of shifts for each day type, e.g. 
	 * Regular has 1 A, 2 N and 1 B shift types 
	 */
	private static int[][] counts = {{1,2,0,0,0,1},{0,0,2,2,2,1},{0,0,2,2,2,1}};
	
	public static int getShiftCount(DayType t) {
		switch (t) {
		case Regular:
			return 3; // sum of a row in the "counts" matrix - 1 (=1 + 2 + 1 - 1)
		case Weekend:
			return 6;
		default:
			return 6;
		}
	}
	
	public static int getShiftTypeNumber(DayType t) {
		switch (t) {
		case Regular:
			return 2;
		default:
			return 3;
		}
	}
	
	public static int getShiftTypeCapacity(DayType t, ShiftType s) {
		return counts[t.ordinal()][s.ordinal()];
	}
	
	public static List<String> getShiftTypeDescriptors(DayType t) {
		LinkedList<String> result = new LinkedList<String>();
		for (int i=0;i<counts[t.ordinal()].length - 1;i++) {
			if (counts[t.ordinal()][i]>0)
			result.add(ShiftType.values()[i].toString());
		}
		return result;
	}
	
	public static int getShiftCount(DayType dayType, ShiftType shiftType) {
		return counts[dayType.ordinal()][shiftType.ordinal()];
	}
	
}
